package com.xzzz.irda.registry.service;

import lombok.Data;
import org.springframework.cloud.client.ServiceInstance;

import java.net.URI;
import java.util.Map;

@Data
public class RedisServiceInstance implements ServiceInstance {

    private String instanceId;

    private String serviceId;

    private String host;

    private int port;

    private boolean secure;

    private Map<String, String> metadata;

    @Override
    public String getInstanceId() {
        return ServiceUtil.buildInstanceId(this);
    }

    /**
     * 本服务的完整地址：http://host:post
     * @return
     */
    @Override
    public URI getUri() {
        return ServiceUtil.buildUri(this);
    }
}
